package cn.mst.vrs.dal.mysql.ordertype;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.mst.vrs.controller.admin.ordertype.vo.OrderTypePageReqVO;
import cn.mst.vrs.dal.dataobject.ordertype.OrderTypeDO;
import com.baomidou.mybatisplus.extension.toolkit.ChainWrappers;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 订单类型 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface OrderTypeMapper extends BaseMapperX<OrderTypeDO> {

    default PageResult<OrderTypeDO> selectPage(OrderTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderTypeDO>()
                .eqIfPresent(OrderTypeDO::getCode, reqVO.getCode())
                .eqIfPresent(OrderTypeDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(OrderTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderTypeDO::getId));
    }

    default List<OrderTypeDO> selectDictList() {
        return ChainWrappers.lambdaQueryChain(this)
                .select(OrderTypeDO::getId, OrderTypeDO::getCode)
                .list();
    }
}